Channel encoding is used in communication systems to improve data transmission reliability, so as to ensure communication quality. Polar codes, proposed by Professor Arikan of Turkey, are the first kind of codes that are theoretically proven to be able to achieve the Shannon capacity and having low encoding and decoding complexity.
A polar code is a linear block code. An encoding matrix of the polar code is GN, which is an N×N matrix.
An encoding process for generating a polar code x1N (x1N=x1, x2, . . . . , xN) is:x1N=u1NGN,where u1N=(u1, u2, . . . , uN) is a binary row vector having a length of N bits (N is also called a mother code length), GN is the coding matrix, and GN=F2⊗(log2(N)). F2⊗(log2(N)) is a Kronecker product of a number log2 N of matrices F2, and the matrix F2 is:
      F    2    =            [                                    1                                0                                                1                                1                              ]        .  
In the encoding process of the polar code, some bits in the row vector u1N are used to carry information, and these bits are referred to as information bits. An index set of these bits is represented by a set A. Other bits are set to a fixed value that is pre-agreed upon between a receiving end and a transmitting end of the polar code, and these bits are referred to as fixed bits or frozen bits. An index set of the fixed bits or frozen bits is represented by a set Ac, which is a complement set of set A.
The encoding process of the polar code x1N=u1NGN is equivalent to x1N=uAGN(A)⊕uAcGN(AC). Herein, GN(A) is a submatrix formed by rows in the GN that correspond to indexes in the set A, and GN(Ac) is a submatrix formed by rows in the GN that correspond to indexes in the set Ac. uAc is an information bit set of the u1N, and the number of the information bits in the uAc is K. uAc is a frozen bit set of the u1N, and the number of the frozen bits in the uAC is N−K. The frozen bits are known bits. Value of the frozen bits is normally set to 0, but the value of the frozen bits may be randomly set, provided that the receiving end and the transmitting end of the polar code have pre-agreed on the value of the frozen bits. When the frozen bits are set to 0, a polar code encoding output may be simplified as x1N=uAGN(A), in which GN(A) is a K×N matrix.
A process of constructing a polar code is a process of selecting the set A, and the selection of the set A determines the performance of the polar code. The process of constructing the polar code normally includes: determining, based on a mother code length N, that a total of N polarized channels exist, where each of the polarized channels corresponds to one row in an encoding matrix, respectively; calculating a reliability of each of the polarized channels; forming the information bit index set A using indexes of first K polarized channels with relatively high reliabilities, and forming the frozen bit index set Ac using indexes of the remaining (N−K) polarized channels. The set A determines bit positions of the information bits in x1N, and the set Ac determines bit positions of the frozen bits in x1N.
It can be learned from the encoding matrix that a code length of an original polar code (mother code) is an integer power of 2. In practical applications, however, length of a polar code need to be set to any code length, and this is achieved by a process called rate matching.
In the prior art, there are three main rate matching schemes of the polar code: puncturing, shortening, and repetition. In the first two schemes, a mother code whose length exceeds a target code length is usually punctured or shortened, to achieve the target code length. The punctured or shortened code is filled during decoding, to restore to the length of the mother code. Before decoding, a log-likelihood ratio LLR of the corresponding location is restored according to a predetermined rule, to implement rate de-matching.
To balance encoding performance with encoding complexity, the communication system may determine, according to an agreed rule, to use a repetition-based rate matching scheme. A polar code obtained through encoding using a mother code length is repeated, to obtain a target code length greater than the mother code length, thereby implementing rate matching of the polar code. Different from puncturing or shortening, repetition refers to repeatedly sending, in a specific sequence, an encoded bit sequence that is encoded as the mother code length, until the target code length is reached, thereby implementing rate matching. A decoder combines log-likelihood ratios (LLR) of repetition locations to implement rate de-matching, and performs decoding by using the determined mother code length. Repetition can reduce decoding complexity, a delay, and a hardware implementation. However, in some cases, repetition causes a loss to polar code performance.